import Vue from 'vue';
import VueRouter from 'vue-router';
import index from '../views/index.vue';
import login from '../views/login.vue';
import forgot from '../views/forgot.vue';
Vue.use(VueRouter)

const routes = [
	// 主页
	{
		path: '/',
		name: 'index',
		component: index,
		meta: {
			index: 0,
			title: '首页'
		}
	},

	// 登录
	{
		path: '/login',
		name: 'login',
		component: login,
		meta: {
			index: 0,
			title: '登录'
		}
	},


	// 忘记密码
	{
		path: '/forgot',
		name: "forgot",
		component: forgot,
		meta: {
			index: 0,
			title: '忘记密码'
		}
	},

	// 修改密码
	{
		path: '/user/password',
		name: "password",
		component: () => import("../views/user/password.vue"),
		meta: {
			index: 0,
			title: '修改密码'
		}
	},

	// 视频播放页
	{
		path: "/media/video",
		name: "video",
		component: () => import('../views/media/video.vue'),
		meta: {
			index: 0,
			title: "视频"
		}
	},

	// 音频播放页
	{
		path: "/media/audio",
		name: "audio",
		component: () => import('../views/media/audio.vue'),
		meta: {
			index: 0,
			title: "音频"
		}
	},



	// 友情链接路由
	// {
	// 	path: '/link/table',
	// 	name: 'link_table',
	// 	component: () => import('../views/link/table.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '链接列表'
	// 	}
	// },
	// {
	// 	path: '/link/view',
	// 	name: 'link_view',
	// 	component: () => import('../views/link/view.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '链接详情'
	// 	}
	// },

	// 轮播图路由
	{
		path: '/slides/table',
		name: 'slides_table',
		component: () => import('../views/slides/table.vue'),
		meta: {
			index: 0,
			title: '轮播图列表'
		}
	},
	{
		path: '/slides/view',
		name: 'slides_view',
		component: () => import('../views/slides/view.vue'),
		meta: {
			index: 0,
			title: '轮播图详情'
		}
	},
		// 文章路由
	{
		path: '/article/table',
		name: 'article_table',
		component: () => import('../views/article/table.vue'),
		meta: {
			index: 0,
			title: '文章列表'
		}
	},
	{
		path: '/article/view',
		name: 'article_view',
		component: () => import('../views/article/view.vue'),
		meta: {
			index: 0,
			title: '文章详情'
		}
	},

	// 文章分类路由
	{
		path: '/article_type/table',
		name: 'article_type_table',
		component: () => import('../views/article_type/table.vue'),
		meta: {
			index: 0,
			title: '文章分类列表'
		}
	},
	{
		path: '/article_type/view',
		name: 'article_type_view',
		component: () => import('../views/article_type/view.vue'),
		meta: {
			index: 0,
			title: '文章分类详情'
		}
	},
	
	// 广告路由
	// {
	// 	path: '/ad/table',
	// 	name: 'ad_table',
	// 	component: () => import('../views/ad/table.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '广告列表'
	// 	}
	// },
	// {
	// 	path: '/ad/view',
	// 	name: 'ad_view',
	// 	component: () => import('../views/ad/view.vue'),
	// 	meta: {
	// 		index: 0,
	// 		title: '广告详情'
	// 	}
	// },



	// 公告路由
	{
		path: '/notice/table',
		name: 'notice_table',
		component: () => import('../views/notice/table.vue'),
		meta: {
			index: 0,
			title: '公告列表'
		}
	},
	{
		path: '/feedback/table',
		name: 'feedback_table',
		component: () => import('../views/feedback/table.vue'),
		meta: {
			index: 0,
			title: '用户反馈列表'
		}
	},
	{
		path: '/feedback/view',
		name: 'feedback_view',
		component: () => import('../views/feedback/view.vue'),
		meta: {
			index: 0,
			title: '用户反馈详情'
		}
	},
	{
		path: '/notice/view',
		name: 'notice_view',
		component: () => import('../views/notice/view.vue'),
		meta: {
			index: 0,
			title: '公告消息详情'
		}
	},


	// 评论路由
	{
		path: '/comment/table',
		name: 'comment_table',
		component: () => import('../views/comment/table.vue'),
		meta: {
			index: 0,
			title: '评论列表'
		}
	},
	{
		path: '/comment/view',
		name: 'comment_view',
		component: () => import('../views/comment/view.vue'),
		meta: {
			index: 0,
			title: '评论详情'
		}
	},

	// 专家用户路由
	{
		path: '/expert_users/table',
		name: 'expert_users_table',
		component: () => import('../views/expert_users/table.vue'),
		meta: {
			index: 0,
			title: '专家用户列表'
		}
	},
	{
		path: '/expert_users/view',
		name: 'expert_users_view',
		component: () => import('../views/expert_users/view.vue'),
		meta: {
			index: 0,
			title: '专家用户详情'
		}
	},
	// 普通用户路由
	{
		path: '/ordinary_users/table',
		name: 'ordinary_users_table',
		component: () => import('../views/ordinary_users/table.vue'),
		meta: {
			index: 0,
			title: '普通用户列表'
		}
	},
	{
		path: '/ordinary_users/view',
		name: 'ordinary_users_view',
		component: () => import('../views/ordinary_users/view.vue'),
		meta: {
			index: 0,
			title: '普通用户详情'
		}
	},
	// 会议信息路由
	{
		path: '/meeting_information/table',
		name: 'meeting_information_table',
		component: () => import('../views/meeting_information/table.vue'),
		meta: {
			index: 0,
			title: '会议信息列表'
		}
	},
	{
		path: '/meeting_information/view',
		name: 'meeting_information_view',
		component: () => import('../views/meeting_information/view.vue'),
		meta: {
			index: 0,
			title: '会议信息详情'
		}
	},

	// 大会组委路由
	{
		path: '/committee_member/table',
		name: 'committee_member_table',
		component: () => import('../views/committee_member/table.vue'),
		meta: {
			index: 0,
			title: '大会组委列表'
		}
	},
	{
		path: '/committee_member/view',
		name: 'committee_member_view',
		component: () => import('../views/committee_member/view.vue'),
		meta: {
			index: 0,
			title: '大会组委详情'
		}
	},

	// 报告嘉宾路由
	{
		path: '/speaker/table',
		name: 'speaker_table',
		component: () => import('../views/speaker/table.vue'),
		meta: {
			index: 0,
			title: '报告嘉宾列表'
		}
	},
	{
		path: '/speaker/view',
		name: 'speaker_view',
		component: () => import('../views/speaker/view.vue'),
		meta: {
			index: 0,
			title: '报告嘉宾详情'
		}
	},

	// 征稿主题路由
	{
		path: '/call_for_papers/table',
		name: 'call_for_papers_table',
		component: () => import('../views/call_for_papers/table.vue'),
		meta: {
			index: 0,
			title: '征稿主题列表'
		}
	},
	{
		path: '/call_for_papers/view',
		name: 'call_for_papers_view',
		component: () => import('../views/call_for_papers/view.vue'),
		meta: {
			index: 0,
			title: '征稿主题详情'
		}
	},

	// 专家参会路由
	{
		path: '/expert_participation/table',
		name: 'expert_participation_table',
		component: () => import('../views/expert_participation/table.vue'),
		meta: {
			index: 0,
			title: '专家参会列表'
		}
	},
	{
		path: '/expert_participation/view',
		name: 'expert_participation_view',
		component: () => import('../views/expert_participation/view.vue'),
		meta: {
			index: 0,
			title: '专家参会详情'
		}
	},
	// 专家住宿路由
	{
		path: '/expert_accommodation/table',
		name: 'expert_accommodation_table',
		component: () => import('../views/expert_accommodation/table.vue'),
		meta: {
			index: 0,
			title: '专家住宿列表'
		}
	},
	{
		path: '/expert_accommodation/view',
		name: 'expert_accommodation_view',
		component: () => import('../views/expert_accommodation/view.vue'),
		meta: {
			index: 0,
			title: '专家住宿详情'
		}
	},
	// 专家签到路由
	{
		path: '/expert_check_in/table',
		name: 'expert_check_in_table',
		component: () => import('../views/expert_check_in/table.vue'),
		meta: {
			index: 0,
			title: '专家签到列表'
		}
	},
	{
		path: '/expert_check_in/view',
		name: 'expert_check_in_view',
		component: () => import('../views/expert_check_in/view.vue'),
		meta: {
			index: 0,
			title: '专家签到详情'
		}
	},
	// 专家签退路由
	{
		path: '/expert_sign_off/table',
		name: 'expert_sign_off_table',
		component: () => import('../views/expert_sign_off/table.vue'),
		meta: {
			index: 0,
			title: '专家签退列表'
		}
	},
	{
		path: '/expert_sign_off/view',
		name: 'expert_sign_off_view',
		component: () => import('../views/expert_sign_off/view.vue'),
		meta: {
			index: 0,
			title: '专家签退详情'
		}
	},
	// 用户参会路由
	{
		path: '/user_participation/table',
		name: 'user_participation_table',
		component: () => import('../views/user_participation/table.vue'),
		meta: {
			index: 0,
			title: '用户参会列表'
		}
	},
	{
		path: '/user_participation/statistics',
		name: 'user_participation_statistics',
		component: () => import('../views/user_participation/statistics.vue'),
		meta: {
			index: 1,
			title: '报名数据统计'
		}
	},
	{
		path: '/user_participation/view',
		name: 'user_participation_view',
		component: () => import('../views/user_participation/view.vue'),
		meta: {
			index: 0,
			title: '用户参会详情'
		}
	},
	// 用户住宿路由
	{
		path: '/user_accommodation/table',
		name: 'user_accommodation_table',
		component: () => import('../views/user_accommodation/table.vue'),
		meta: {
			index: 0,
			title: '用户住宿列表'
		}
	},
	{
		path: '/user_accommodation/view',
		name: 'user_accommodation_view',
		component: () => import('../views/user_accommodation/view.vue'),
		meta: {
			index: 0,
			title: '用户住宿详情'
		}
	},
	// 用户签到路由
	{
		path: '/user_check_in/table',
		name: 'user_check_in_table',
		component: () => import('../views/user_check_in/table.vue'),
		meta: {
			index: 0,
			title: '用户签到列表'
		}
	},
	{
		path: '/user_check_in/view',
		name: 'user_check_in_view',
		component: () => import('../views/user_check_in/view.vue'),
		meta: {
			index: 0,
			title: '用户签到详情'
		}
	},
	// 用户签退路由
	{
		path: '/user_sign_out/table',
		name: 'user_sign_out_table',
		component: () => import('../views/user_sign_out/table.vue'),
		meta: {
			index: 0,
			title: '用户签退列表'
		}
	},
	{
		path: '/user_sign_out/view',
		name: 'user_sign_out_view',
		component: () => import('../views/user_sign_out/view.vue'),
		meta: {
			index: 0,
			title: '用户签退详情'
		}
	},
	// 专家排座路由
	{
		path: '/expert_seating/table',
		name: 'expert_seating_table',
		component: () => import('../views/expert_seating/table.vue'),
		meta: {
			index: 0,
			title: '专家排座列表'
		}
	},
	{
		path: '/expert_seating/view',
		name: 'expert_seating_view',
		component: () => import('../views/expert_seating/view.vue'),
		meta: {
			index: 0,
			title: '专家排座详情'
		}
	},
	// 用户排座路由
	{
		path: '/user_seat_arrangement/table',
		name: 'user_seat_arrangement_table',
		component: () => import('../views/user_seat_arrangement/table.vue'),
		meta: {
			index: 0,
			title: '用户排座列表'
		}
	},
	{
		path: '/user_seat_arrangement/view',
		name: 'user_seat_arrangement_view',
		component: () => import('../views/user_seat_arrangement/view.vue'),
		meta: {
			index: 0,
			title: '用户排座详情'
		}
	},
	// 专家通知路由
	{
		path: '/expert_notification/table',
		name: 'expert_notification_table',
		component: () => import('../views/expert_notification/table.vue'),
		meta: {
			index: 0,
			title: '专家通知列表'
		}
	},
	{
		path: '/expert_notification/view',
		name: 'expert_notification_view',
		component: () => import('../views/expert_notification/view.vue'),
		meta: {
			index: 0,
			title: '专家通知详情'
		}
	},
	// 用户通知路由
	{
		path: '/user_notifications/table',
		name: 'user_notifications_table',
		component: () => import('../views/user_notifications/table.vue'),
		meta: {
			index: 0,
			title: '用户通知列表'
		}
	},
	{
		path: '/user_notifications/view',
		name: 'user_notifications_view',
		component: () => import('../views/user_notifications/view.vue'),
		meta: {
			index: 0,
			title: '用户通知详情'
		}
	},

	// 用户路由
	{
		path: '/user/table',
		name: 'user_table',
		component: () => import('../views/user/table.vue'),
		meta: {
			index: 0,
			title: '用户列表'
		}
	},
	{
		path: '/user/view',
		name: 'user_view',
		component: () => import('../views/user/view.vue'),
		meta: {
			index: 0,
			title: '用户详情'
		}
	},
	{
		path: '/user/info',
		name: 'user_info',
		component: () => import('../views/user/info.vue'),
		meta: {
			index: 0,
			title: '个人信息'
		}
	},
	// 用户组路由
	{
		path: '/user_group/table',
		name: 'user_group_table',
		component: () => import('../views/user_group/table.vue'),
		meta: {
			index: 0,
			title: '用户组列表'
		}
	},
	{
		path: '/user_group/view',
		name: 'user_group_view',
		component: () => import('../views/user_group/view.vue'),
		meta: {
			index: 0,
			title: '用户组详情'
		}
	},
	// 收藏管理
	{
		path: '/collect/table',
		name: 'collect_table',
		component: () => import('../views/collect/table.vue'),
		meta: {
			index: 0,
			title: '收藏管理'
		}
	},
	{
		path: '/collect/view',
		name: 'collect_view',
		component: () => import('../views/collect/view.vue'),
		meta: {
			index: 0,
			title: '收藏详情'
		}
	},
	// 点赞管理
	{
		path: '/praise/table',
		name: 'praise_table',
		component: () => import('../views/praise/table.vue'),
		meta: {
			index: 0,
			title: '点赞管理'
		}
	},
	// 点击统计
	{
		path: '/hits/table',
		name: 'hits_table',
		component: () => import('../views/hits/table.vue'),
		meta: {
			index: 0,
			title: '点击统计'
		}
	},
]

const router = new VueRouter({
	mode: 'hash',
	base: process.env.BASE_URL,
	routes
})

router.beforeEach((to, from, next) => {
	let token = to.query.token;
	if (token){
		$.db.set("token",token,120);
	}
	next();
})

router.afterEach((to, from, next) => {
	let title = "学术会议管理系统-admin";
	document.title = title;
})

export default router
